package com.myeclipse.search;

import org.json.JSONObject;

public class Code {

	private String jsonString;
	private int id;
	private String type;
	private int matchcount;
	private int linecount;
	private String source;
	private String name;
	private String filename;
	private String location;
//	public String firstName;
//	public String lastName;
//	public Code(String first,String last){
//		firstName=first;
//		lastName=last;
//	}
	public Code(String jsonString){
		this.jsonString=jsonString;
		JSONObject jsonObject=new JSONObject(jsonString);
		id=jsonObject.getInt("id");
		type=jsonObject.getString("type");
		matchcount=jsonObject.getInt("regexcount");
		linecount=jsonObject.getInt("linecount");
		source=jsonObject.getString("source");
		name=jsonObject.getString("name");
		filename=jsonObject.getString("filename");
		location=jsonObject.getString("location");
		
	}
	public int getId(){
		return id;
	}
	public String getTpye(){
		return type;
	}
	public String getMatchcount(){
		return Integer.toString(matchcount);
	}
	public String getLinecount(){
		return Integer.toString(linecount);
	}
	public String getSource(){
		return source;
	}
	public String getName(){
		return name+" "+location+filename;
	}
	
}
